State of energy estimation of lithium-ion battery based on long short-term memory optimization Adaptive Cubature Kalman filter

State of energy (SOE) is an important parameter to ensure the safety and reliability of lithium-ion battery (LIB) system. The safety of LIBs, the development of artificial intelligence, and the increase in computing power have provided possibilities for big data computing. This article studies SOE estimation problem of LIBs, aiming to improve the accuracy and adaptability of the estimation. Firstly, in the SOE estimation process, adaptive correction is performed by iteratively updating the observation noise equation and process noise equation of the Adaptive Cubature Kalman Filter (ACKF) to enhance the adaptive capability. Meanwhile, the adoption of high-order equivalent models further improves the accuracy and adaptive ability of SOE estimation. Secondly, Long Short-term Memory (LSTM) is introduced to optimize Ohmic internal resistance (OIR) and actual energy (AE), further improving the accuracy of SOE estimation. Once again, in the process of OIR and AE estimation, the iterative updating of the observation noise equation and process noise equation of ACKF were also adopted to perform adaptive correction and enhance the adaptive ability. Finally, this article establishes a SOE estimation method based on LSTM optimized ACKF. Validate the LSTM optimized ACKF method through simulation experiments and compare it with individual ACKF methods. The results show that the ACKF estimation method based on LSTM optimization has an SOE estimation error of less than 0.90% for LIB, regardless of the SOE at 100%, 65%, and 30%, which is more accurate than the SOE estimation error of ACKF alone. It can be seen that this study has improved the accuracy and adaptability of LIB’s SOE estimation, providing more accurate data support for ensuring the safety and reliability of lithium batteries.


Introduction
With the environmental pollution caused by the combustion of fossil fuels, the development of green and sustainable energy storage devices is of great significance for the utilization of renewable energy.As a new type of energy storage equipment that provides electricity for the world, lithium batteries have received more and more attention [1][2][3][4].
State of energy (SOE) is an important parameter of battery management system (BMS), which is the ratio of remaining available energy to the maximum available energy [5,6], and is one of the most critical parameters in BMS.In order to improve the performance of electric vehicle BMS, a high-precision SOE estimation algorithm is needed [7].
However, accurate SOE estimation is challenging because of erratic battery dynamics and SOE variation with current, temperature, operating conditions, etc.In recent years, Cubature Kalman Filter (CKF) has been widely used in SOE estimation of LIBs due to its good dynamic tracking ability.Arasaratnam and Haykin [8,9] first proposed a CKF method of volume Kalman filtering based on Cubature integral transformation.The research of CKF in LIBs state estimation is mainly divided into two directions(as shown in Fig 1): one is to optimize the parameters of CKF; The second is to optimize the noise effect of CKF.
In terms of parameter optimization, the first step is to optimize matrix decomposition.Li et al. [10] proposed an improved CKF algorithm, which implements the diagonalization decomposition of the covariance matrix and a strong tracking filter.In Ref. [11], three typical matrix decomposition strategies, namely, singular value decomposition (SVD), UR decomposition, and LU decomposition are introduced, to replace the Cholesky decomposition in the traditional CKF.
In terms of parameter optimization, the second research direction is to correct the parameters of LIBs.In Ref. [12], forgetting factor recursive least squares (FFRLS), optimal bounding ellipsoid (OBE), and linear Kalman filter (LKF) are discussed, and the OBE algorithm is more suitable.In Ref. [13], an efficient method of parameter identification for LIBs using CKF and least square with gradient correction is proposed.Li et al. [14] introduced the constraint condition of the pneumatic principle to replace the temperature correction coefficient, which can realize the fast convergence of SOC.Li et al. [15] the vector forgetting factor recursive least squares method is utilized for model parameter online identification.
Finally, intelligent technology is integrated into the parameter optimization process.Wang et al. [16] combined the H 1 filter with SVD-CKF to solve the problem of decreased SOC estimation accuracy caused by temperature changes.Ma et al. [17] used the generalized maximum correlation criterion and fixed-point iteration method to enhance the robustness of the filter and better adapt to various complex situation.Fu et al. [18] introduced a new type of weighted multi-innovation Cubature Kalman filter (WMICKF).This filter can innovate vector weighting calculations based on error distribution and time distribution, thereby achieving SOC estimation.Compared to traditional methods, WMICKF has higher estimation accuracy and better robustness, and can effectively handle SOC estimation problems in complex and everchanging environments.Song et al. [19] proposed a new joint support vector machine-cubature Kalman filter method.In order to study the noise effect of CKF optimization, the noise matrix is modified first.Liu et al. [20] found that the Sage-Husa estimator can timely grasp the statistical characteristics of process and measurement noise, and make corrections to them.Experiments have shown that this algorithm has strong robustness to the initial error of SOC.Wang et al. [21] proposed a novel state noise matrix self-tuning CKF algorithm based on the optimal model.The experimental results show that this improved CKF algorithm performs well in tracking the minimum SOC envelope of parallel battery module.During the voltage plateau period, the estimated SOC error remains stable within 1.2%, and at the end of discharge, it remains stable within 4.3%.These data fully demonstrate the effectiveness of the proposed method.Wang et al. [22] proposed a novel variable forgetting factor recursive least square (VFFRLS) noise adaptive CKF algorithm based on the VFFRLS algorithm to cope with changes in model parameters.In Ref. [23], Adaptive noise recognition combined with dual Kalman filters to achieve higher robustness and computational efficiency.
In the same way as parameter optimization, intelligent technology is also incorporated in noise optimization.In Ref. [24], the second-order resistor capacitor equivalent circuit model and the VFFRLS online parameter identification method were adopted, and a fuzzy adaptive controller was proposed based on this.The purpose of this controller is to improve the convergence speed of SOC estimation for steady-state Kalman filter.Tian et al. [25] elaborates on a method of integrating long-short term memory LSTM networks with ACKF to estimate battery state more accurately and stably.
In summary, the integration of intelligent technology and CKF has become a development trend in the future.The integration of intelligent technology and CKF will further improve the accuracy and adaptive characteristics of SOE estimation.
Validate the LSTM optimized ACKF method through simulation experiments and compare it with individual ACKF methods.The results indicate that the proposed method can significantly improve the estimation accuracy of SOE.
State of energy estimation of LIBs based on long short-term memory optimization ACKF has been proposes in the paper, and the superiority of method is verified.There are three original contributions as follows: 1.In the process of SOE estimation, the observation noise equation and process noise equation of ACKF are updated iteratively to make adaptive correction and enhance the adaptive ability.
2. The LSTM is introduced to optimize the Ohmic internal resistance (OIR) and actual energy (AE), and further improve the accuracy of SOE estimation.
3. In the process of OIR and AE estimation, the observation noise equation and process noise equation of ACKF are updated iteratively to make adaptive correction and enhance the adaptive ability.

SOE
The SOE of LIB: the ratio of the remaining energy to the nominal energy, namely: where, S ek , i k , and U k are the SOE, current, and working voltage of a LIB at k time in discrete state; E is nominal energy of a LIB; Δt is the sampling period.

SOE estimation model based on TRCEM
In order to simulate the charge and discharge characteristics of lithium-ion batteries more accurately, in the process of selecting the equivalent circuit model, not only the polarization of lithium-ion batteries, but also the complexity and practicability of the equivalent model should be considered.Based on the consideration of accuracy, complexity, and practicability, thirdorder resistor-capacitance equivalent model (TRCEM) is chosen in this paper.
In resistance, electrochemical polarization internal resistance, and the internal resistance of concentration difference polarization; C 1 , C 2 , and C 3 is the Ohmic polarization capacitance, electrochemical polarization capacitance, and concentration differential polarization capacitance; U 1 , U 2 , and U 3 are the voltages at both ends of capacitor C 1 , C 2 , and C 3 respectively; According to Fig 2, the discrete state equation of LIB's TRCEM is as follows: According to Fig 2, the discrete observation equation of LIB's TRCEM is as follows: As ; where, kþ1 are the estimated voltage values of R 1 , R 2 , R 3 at k and k+1 time in discrete state; q k , γ k are independent system noises; U oc (S e ) is the OCV of a LIB corresponding to the SOE value of a LIB at the k time in discrete state.

Model parameter identification
The U L , i L , and U OC of the LIB collected through the charge/discharge test using test equipment (BTS20).Model parameter identification based on the least square method is not repeated in this article because the method is described in detail in Refs.[26].Both U OC and R 0 adopt the off-line identification method [6,26].The initial values of parameters identified in this paper are shown in Table 1.

SOE estimation
In this article, ACKF is used to carry out SOE estimation research based on the TRCEM, and the estimation accuracy and adaptability characteristics are compared and analyzed [27].

SOE estimation based on ACKF
From Formulas (04) and (05), the state and observation formulas: where, k and E k are the state variable OIR and AE; u k and y k are the input and observation variables of the system, which are the current and the working voltage of a LIB.q k and γ k are the zero-mean Gaussian white noise; the error covariance matrices of q k and γ k are Q k and R k .
The ACKF algorithm flow: Step 1: Initialize x k : Step 2: Time update of x k : Cubature Points, State prediction, Where [1] indicates that n is the set of points in u space, i.e.: State prediction covariance: Step 3: Measurement update of y k : Cubature Points, Observation prediction: The Kalman gain is as follows: The optimal estimation of state variables is as follows: The optimal estimate of the covariance is as follows: State error and observation error: Step 4: Process noise covariance equation is as follows: Step 5: Observation noise covariance equation is as follows: , b is the forgetting factor,0<b<1; x k , y k , and P k are the estimation of the state, estimation of observation value variable, and estimation of the error covariance; xk ; ŷk , and Pk are optimal estimation of the state variable, actual observation value variable, and optimal estimation of the error covariance.

OIR and AE estimation based on ACKF
The state and observation formulas of the system with the newly added state parameters: where q θ,k is the noise on the input variable, and it is the zero-mean Gaussian white noise; γ θ,k is the noise on the output variable, and it is the zero-mean Gaussian white noise; the error covariance matrices of q θ,k and γ θ,k are Q θ,k and R θ,k ; the state variable θ is estimated based on ACKF algorithm, and the estimated values of the LIB's OIR and actual energy (AE) are calculated.In order to improve the accuracy, the error between the actual value and the estimated value of the working voltage is optimized.
The ACKF algorithm flow: Step 1: Initialize θ k : Step 2: Time update of θ k : Cubature Points, S y;kÀ 1 ¼ ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi Py;kÀ 1 q State prediction, Step 3: Measurement update of D k : Cubature Points, Observation prediction: The Kalman gain is as follows: The optimal estimation of state variables is as follows: The optimal estimate of the covariance is as follows: State error and observation error: Step 4: Process noise covariance equation is as follows: Step 5: Observation noise covariance equation is as follows: is the forgetting factor,0<b θ <1; θ k , z k , and P θ,k are the estimation of the state, estimation of observation value variable, and estimation of the error covariance; ŷk ; ẑk , and Py;k are optimal estimation of the state variable, actual observation value variable, and optimal estimation of the error covariance.

Optimize OIR and AE based on LSTM
In order to further improve the SOE estimation accuracy, this paper adopts LSTM to optimize OIR and AE in the Kalman filter process [28].The memory cell structure of LSTM is demonstrated in Fig 3.
where θ k and c k are the input data and status of the memory cell at t time step, ŷk denotes the output data at the previous time step.f k , i k , and o k represent forget gate, input gate, and output gate, respectively.This process defined above is repeated at each time step.Additionally, σ and * are the sigmoid function and element-wise product.ω and b are the weight matrices and bias vectors.In this paper, the main parameters of the LSTM model are as follows: 3 input layer variables; 3 output layer variables; 150 hidden layer units; 1 hidden layer; 200 epochs; and an adjustable parameter, batch_size, of 128.

Experiment
The experimental equipment is shown in Fig 4 .BTS20 is used to charge and discharge the LIB (as shown in Table 2).First of all, the LIB is charged, and after full, the LIB is discharged several times, and different discharge currents are used.Finally, simulation verification and analysis are carried out based on MATLAB R2023a.
To verify the adaptive characteristics of LSTM optimization ACKF algorithm, a test experiment was carried out on a fully charged LIB, starting from SOE of 100% to ending at SOE of 25%.In this article, the initial SOE values were changed to 100%, 65%, and 30% separately, and the adaptive and error curves were observed and analyzed.
In the process of simulation verification, the estimated values of SOE were calculated based on LSTM optimization ACKF algorithm, and the actual values were acquired by BTS20.According to Eq (30), the formula for error is as follows.The SOE error of LSTM optimization ACKF formula: where, S actual is the value acquired by the test equipment.

SOE starts at 100%
The simulation comparison validation curve of SOE at 100% startup is shown in

SOE starts at 65%
The simulation comparison validation curve of SOE at 65% startup is shown in Fig 6.
The SOE estimation curve of LIB is shown in Fig 6A .The following figure shows the SOE error curve, and the above figure shows the SOE adaptive estimation curve.As shown in Table 3 and Fig   The estimation method based on ACKF+LSTM is superior to using ACKF alone in terms of prediction accuracy and stability.By using ACKF+LSTM, the accuracy of SOE estimation has been significantly improved, which is of great significance for real-time battery management systems.
https://doi.org/10.1371/journal.pone.0306165.t005Compared to when the SOE is 100%, the covariance change of observation noise is relatively small, but the covariance change of process noise is relatively large.

SOE starts at 30%
The simulation comparison validation curve of SOE at 30% startup is shown in  3 and Fig 7, based on ACKF, the SOE error is -0.82% to 0.93%.Based on ACKF+LSTM, the SOE error is -0.84% to 0.90%.With the increase of the initial error, the difference of standard deviation increases, which accords with the statistical law.

Discussion
The simulation results show that the method based on ACKF+LSTM has an SOE estimation error of less than 0.88% for LIB regardless of SOE at 100%, 65%, and 30%, which is more accurate than the SOE estimation error of the individual ACKF.As shown in Table 4, compared with accuracy of 1.19% in Ref. [29], 2% in Ref. [30], 1.93% in Ref. [31], 2.34% in Ref. [6], the method has high precision.In addition, the combination method is self-adaptive.
As shown in Table 5, by comparing MSE (Mean square Error), MAE (Mean Absolute Error), RMSE (Root Mean square Error) and SD (Standard Deviation), it can be seen that, the method of ACKF+LSTM is more advantageous.

Conclusions
This article establishes a SOE estimation method based on ACKF+LSTM.In order to improve the accuracy of SOE estimation, LSTM is introduced on the basis of adaptive Kalman filter to optimize OIR and AE, and ACKF and LSTM are combined.Through this method, we can better handle and predict complex nonlinear dynamic systems, and improve the accuracy of SOE estimation.In addition, the proposed SOE estimation method was experimentally validated, and the experimental results showed that the SOE estimation method based on ACKF+LSTM has higher accuracy and robustness.
This paper has made some achievements, there are still many deficiencies: (1) In this paper, the number of samples is not enough, the next step will increase the number of samples, test universality.(2) parameter identification is offline at the moment; the next step will be to carry out the parameter identification of online identification.

Fig 4 .
Fig 4. Battery testing system.(a) The lithium-ion battery.(b) The charge/discharge experiment (BTS20).https://doi.org/10.1371/journal.pone.0306165.g004 Fig 5.The SOE error curve and SOE adaptive estimation curve of LIB are shown in Fig 5A, which were generated through ACKF and LSTM optimized ACKF (ACKF+LSTM).According to Table 5 and Fig 5, the SOE error range based on ACKF ranges from 0% to 0.82%; The SOE error range of ACKF+LSTM is from 0% to 0.83%.The observation noise covariance (ONC) and process noise covariance (PNC) curves of LIB are shown in Fig 5B.The following figure shows the curve of PNC, and the above figure shows the curve of ONC.Based on the observation and processing of the variation trend of the noise covariance curve, this algorithm has convergence.

Fig 5 .
Fig 5.The simulation comparative validation curve when SOE starts at 100%.(a) Estimation and error curves of SOE, (b) ONC and PNC.https://doi.org/10.1371/journal.pone.0306165.g005 6, based on ACKF, the SOE error is -0.79% to 0.91%.Based on ACKF+LSTM, the SOE error is -0.78% to 0.85%.The ONC and PNC curves of LIB are shown in Fig 6B.The following figure shows the curve of PNC, and the above figure shows the curve of ONC.Based on the observation and processing of the variation trend of the noise covariance curve, this algorithm has convergence.

Fig 7 .
The SOE estimation curve of LIB is shown in Fig 7A.The following figure shows the SOE error curve, and the above figure shows the SOE adaptive estimation curve.As shown in Table